<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Demo-props</title>
</head>
<body>
<div id="application">
    <comp1 :count="5"></comp1>
</div>
<script src="../vue3.js"></script>
<script>
    const app = Vue.createApp({})
    const comp2 = {
        template: "<div style='color: blue;font-size: 20px'>Hello World</div>"
    }
    const comp1 = {
        data(){
            return {
                thisCount: 0
            }
        },
        methods: {
            click() {
                this.thisCount++
            }
        },
        props: {
            count: Number
        },
        computed: {
            innerCount() {
                return this.count + this.thisCount
            }
        },
        components: {
            "comp2": comp2
        },
        template: "<button @click='click'>点击</button><div>计数：{{this.innerCount}}</div><comp2></comp2>"
    }
    app.component("comp1", comp1)
    app.mount("#application")
</script>
</body>
</html>